<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .wrap {
      display: flex;
      display: inline-flex;
      flex-direction: column;
      border: 1px solid #000;
    }
    .box1 {
      background-color: orange;
    }
    .box2 {
      background-color: blueviolet;
    }
  </style>
</head>
<body>
  <div class="wrap">
    <div class="box1" contenteditable="true">1111111111111111111111111111</div>
    <div class="box2">222222</div>
  </div>
</body>
<script>
  let str = '123';
  function f1() {
    let str = '456';
    console.log('f1', str); // 456
    return function f2() {
      console.log('f2', str); // 456
    }
  };
  f1()();
</script>
</html>